import request from '@/utils/request'

// 获取一级分类列表
export const getCategory1List = () =>
  request({ url: '/admin/product/getCategory1', method: 'get' })

export const getCategory2List = (c1id) =>
  request({ url: '/admin/product/getCategory2/' + c1id, method: 'get' })

export const getCategory3List = (c2id) =>
  request({ url: '/admin/product/getCategory3/' + c2id, method: 'get' })

// 根据3个ID,获取平台属性列表
export const getAttrList = (category1Id, category2Id, category3Id) =>
  request({
    url: `/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,
    method: 'get'
  })

// 添加平台属性
export const saveAttrInfo = (data) =>
  request({ url: '/admin/product/saveAttrInfo', method: 'post', data })

// 删除平台属性
export const delAttrInfo = (attrId) =>
  request({ url: `/admin/product/deleteAttr/${attrId}`, method: 'DELETE' })
